package Messages;

import jade.core.Agent;
import Agents.Sensor.ASensor;
import Agents.Messageable;

public class MeasureMessage extends AMessage
{
	public Units unit;
	public int value;
	
	protected String constructSpecialMessage(Messageable agent) 
	{
		return ((Agent)agent).getLocalName() + AMessage.senderSplit + ((ASensor)agent).unit.name() + AMessage.unitSplit + ((ASensor)agent).value;
	}

	protected String constructSpecialMessage(Messageable agent, MessageType type)
	{
		return null;
	}

	protected void retrieveMyMessage(String theMessage) 
	{
		String[] send = theMessage.split(AMessage.senderSplit);
		sender = send[0];
		
		String[] information = send[1].split(AMessage.unitSplit);
		unit = getUnit(information[0]);
		value = Integer.parseInt(information[1]);
	}
}
